<template>
	<!-- 车位详情 -->
	<view class="parkingDetail">
		<view class="box">
			<view class="tubiao">
				<uni-icons type="checkmarkempty" size="45" color="#026cfd"></uni-icons>
			</view>
			<text>{{active==1?'车位审核中，请耐心等待':active==2?'车位审核通过！':''}}</text>
			<uni-steps class="steps" :options="list1" :active="active" active-color="#026cfd" />
			<view class="defails-item">
				<view class="item-title">
					<view></view>
					<text>车位信息</text>
				</view>
				<view class="item-content host">
					<view class="row"><text>小区</text><text>{{community}}</text></view>
					<view class="row"><text>停车场</text><text>{{community}}小区{{tableData.regionParking.regionName}}</text></view>
					<view class="row"><text>车位楼层</text><text>{{tableData.floor}}</text></view>
					<view class="row"><text>车位区域</text><text>{{tableData.regionParking.region.name}}</text></view>
					<view class="row"><text>车位编号</text><text>{{tableData.carparkingId}}</text></view>
					<view class="row"><text>车位状态</text><text class="status">{{tableData.parkingType.carState}}</text></view>
				</view>
			</view>
			<view class="defails-item">
				<view class="item-title">
					<view></view>
					<text>住户信息</text>
				</view>
				<view class="item-content host">
					<view class="row"><text>住户姓名</text><text>{{tableData.person.username}}</text></view>
					<view class="row"><text>手机号码</text><text>{{tableData.person.phoneNumber}}</text></view>
				</view>
			</view>
			<view class="defails-item">
				<view class="item-title">
					<view></view>
					<text>车辆信息</text>
					<text class="closeBind" @click="openBind()">取消绑定</text>
				</view>
				<view class="item-content host">
					<view class="row"><text>车牌号</text><text>{{carData.carNum}}</text></view>
					<view class="row"><text>车辆品牌</text><text>{{carData.carType.carType}}</text></view>
					<view class="row"><text>车辆型号</text><text>{{carData.model}}</text></view>
					<view class="row"><text>车身颜色</text><text>{{carData.carColor}}</text></view>
				</view>
			</view>

		</view>
		<!-- 删除修改 -->
		<view class="operate">
			<navigator url="../../myHouse/addHouse/addHouse" hover-class="navigator-hover">
				<view class="edit">修改</view>
			</navigator>
			<view class="del" @click="open()">删除</view>
		</view>
		<!-- 删除弹出框 -->
		<uni-popup ref="popup" type="bottom">
			<view class="tishi">
				<view class="tishi-top">确定删除此车位信息吗？</view>
				<view class="tishi-sel">
					<text @click="close">否</text>
					<navigator url="../myHouse" hover-class="navigator-hover">
						<text @click="close()">是</text>
					</navigator>
				</view>
			</view>
		</uni-popup>
		<!-- 取消绑定弹出框 -->
		<uni-popup ref="popup1" type="bottom">
			<view class="tishi">
				<view class="tishi-top">确定取消绑定此车辆吗？</view>
				<view class="tishi-sel">
					<text @click="close">否</text>
					<navigator url="../myHouse" hover-class="navigator-hover">
						<text @click="closeBind()">是</text>
					</navigator>
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	import { http } from '../../../utils/http.js'
	export default {
		data() {
			return {
				serialNo:'',
				community:'',
				icon: 'success',
				value: "车位审核中",
				active: 0,
				list1: [{
					title: '车位信息',
				}, {
					title: '物业审核'
				}, {
					title: '认证成功'
				}],
				tableData:{},
				carData:{},
			}
		},
		methods: {
			open() {
				this.$refs.popup.open('top')
			},
			close() {
				this.$refs.popup.close()
			},
			openBind() {
				this.$refs.popup1.open('top')
			},
			closeBind() {
				this.$refs.popup1.close()
			},
		},
		onLoad: function(option) { //option为object类型，会序列化上个页面传递的参数
			console.log(JSON.parse(option.state)); //打印出上个页面传递的参数。
			let getTable = JSON.parse(option.state);
			this.tableData=getTable.table[0]
			if (getTable.v == '审核通过') {
				this.active = 2
			} else if (getTable.v == '审核中') {
				this.active = 1
			}
			try {
				const list = uni.getStorageSync('list');
				if (list) {
					this.serialNo = list.serialNo
					this.community = list.community
				}
			} catch (e) {
				// error
			}
			http({
				url:'/car/list',
				params:{
					page:1,
					limit:0,
					carnum:this.tableData.carNum
				}
			}).then(({data})=>{
				console.log(data)
				this.carData=data[0]
			})

		}
	}
</script>

<style lang="less" scoped>
	.parkingDetail {
		padding: 0 30rpx;

		.box {
			height: 2300rpx;
		}

		.tubiao {
			margin: 60rpx auto;
			margin-bottom: 30rpx;
			width: 90rpx;
			height: 90rpx;
			text-align: center;
			line-height: 89rpx;
			border-radius: 50rpx;
			border: 8rpx solid #026cfd;
		}

		text {
			display: block;
			text-align: center;
			font-size: 34rpx;
		}

		.defails-item {
			padding-top: 40rpx;
			padding-left: 38rpx;
			padding-right: 38rpx;
			display: flex;
			flex-direction: column;
			align-items: flex-start;
			border-radius: 10rpx;
			margin-bottom: 42rpx;
			box-shadow: 0px 0px 15rpx rgba(0, 0, 0, .2);

			.item-title {
				display: flex;
				margin-bottom: 40rpx;
				align-items: center;
				justify-content: flex-start;

				view {
					width: 16rpx;
					height: 34rpx;
					background-color: #056cff;
					border-radius: 8rpx;
				}

				text {
					margin-left: 20rpx;
					font-size: 32rpx;

				}

				.closeBind {
					font-size: 28rpx;
					color: #3c80d2;
					margin-left: 330rpx;
				}
			}

			.item-content {
				width: 100%;
				display: flex;
				flex-direction: column;
				align-items: flex-start;

				.row {
					display: flex;
					width: 100%;
					justify-content: flex-start;
					padding: 30rpx 0;
					border-bottom: 1px solid #eee;

					text:nth-child(1) {
						color: #a8a8a8;
						text-align: left;
						width: 170rpx;
					}

					.status {
						color: #ff9036;
					}
				}

				.row:last-child {
					border: 0px;
				}

			}

			.host {
				.row {
					text:nth-child(1) {
						width: 200rpx;
					}
				}

				.photo {
					padding: 30rpx 0;

					text:nth-child(1) {
						color: #a8a8a8;
						text-align: left;
						margin-bottom: 30rpx;
					}

					#t1 {

						margin-bottom: 40rpx;
					}

				}
			}
		}

		.operate {
			width: 100%;
			height: 140rpx;
			display: flex;
			align-items: center;
			justify-content: center;
			position: fixed;
			left: 0rpx;
			bottom: 0rpx;
			background-color: #ffffff;
			border-top: 1px solid #ccc;

			view {
				width: 334rpx;
				height: 82rpx;
				text-align: center;
				line-height: 82rpx;
				border-radius: 8rpx;
				font-size: 32rpx;
			}

			.edit {
				background-color: #006fff;
				color: white;
				margin-right: 16rpx;
			}

			.del {
				background-color: white;
				color: #c9768a;
				border: 1px solid #c9768a;
			}
		}

		.tishi {
			margin: 300rpx auto;
			width: 600rpx;
			background-color: white;
			border-radius: 8rpx;

			.tishi-top {
				height: 150rpx;
				padding-left: 50rpx;
				line-height: 150rpx;
			}

			.tishi-sel {
				border-top: 1px solid #eee;
				display: flex;
				align-items: c1;

				text {
					flex: 1;
					height: 80rpx;

					text-align: center;
					line-height: 80rpx;
					font-size: 32rpx;

				}

				navigator {
					flex: 1;
				}

				text:nth-child(1) {
					border-right: 1px solid #eee;
				}
			}
		}

	}
</style>
<style lang="less">
	.parkingDetail {
		.uni-steps {
			margin: 60rpx auto;

			.uni-icons {
				font-size: 40rpx !important;
			}
		}

	}
</style>
